package com.test.lyt.controller;

import com.alibaba.fastjson.JSON;
import com.test.lyt.entity.dto.FileDTO;
import com.test.lyt.entity.dto.UserDTO;
import com.test.lyt.entity.po.UserPO;
import com.test.lyt.service.FileService;
import com.test.lyt.uils.Response;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;
import java.util.Map;

@Slf4j
@RestController
@RequestMapping("/v2")
public class FileController {
    @Autowired
    private FileService fileService;
    @PostMapping("/list")
    public Response<Map<String, Object>> createOrUpdate(@RequestBody FileDTO fileDTO) {
        try {
            log.info("创建更新对象Request:{} ", JSON.toJSONString(fileDTO));
            return Response.createSuccess(fileService.queryList(fileDTO));
        } catch (Exception e) {
            log.error("创建更新对象，入参数: ", JSON.toJSONString(fileDTO), e);
            return Response.createError("创建更新对象失败");
        }
    }

}
